package com.zjt.smart.api.intercepter;

import com.zjt.smart.manager.CacheManager;

import java.io.IOException;

import okhttp3.Interceptor;
import okhttp3.Request;
import okhttp3.Response;

/**
 * @author zhengjianting
 * @time 2017/8/25 0025 上午 11:30
 */

public class CacheInterceptor implements Interceptor {

    @Override
    public Response intercept(Chain chain) throws IOException {

        Request request = chain.request();
        Response response = chain.proceed(request);
        CacheManager.getInstance().saveCache(request,response);

        return response;
    }

}
